	$(function() {
		 	$("#address").treemenu({ jsondata: treedata, deep: 2 });
			$("#beginTime").jqxDateTimeInput({ width: "150px", height: "30px", formatString: "yyyy-MM-dd", value: getFirstDayOfLastmonth() });
			$("#endTime").jqxDateTimeInput({ width: "150px", height: "30px", formatString: "yyyy-MM-dd", value: getLastDayOfLastmonth() });
			var tableSource = new $.jqx.dataAdapter({
				dataType: "json",
				dataFields:[
				    { name: "wechat", type: "string" },
				    { name: "name", type: "string" },
				    { name: "sex", type: "int" },
				    { name: "country", type: "string" },
				    { name: "province", type: "string" },
				    { name: "city", type: "string" },
			  	    { name: "total", type: "double" },
				    { name: "branch", type: "string" },
				    { name: "count", type: "int" },
				    { name: "totalCount", type: "int" },
				    { name: "menu", type: "string" },
				    { name: "number", type: "int" },
				    { name: "totalNumber", type: "int" }
				],
				id: "id",
				url: "statistics/customer.do",
				data: { beginTime: format(getFirstDayOfLastmonth(), "Y-M-D"), endTime: format(getLastDayOfLastmonth(), "Y-M-D") }
			});
			$("#dataTable").jqxDataTable({
				width: "100%",
		        source: tableSource,
                pageable: true,
                pageSize: 18,
                pagerButtonsCount: 10,
		        columnsResize: true,
		        serverProcessing: true,
		        sortable: true,
		        columns: [
		            { text: "序号", width: 50, cellsRenderer: function(row){ return (row + 1).toString(); } },
		            { text: "微信    ", dataField: "wechat", minWidth: 100 },
		            { text: "昵称    ", dataField: "name", minWidth: 100 },
		            { text: "性别", dataField: "sex", width: 50, cellsRenderer:function(row, column, value, rowData){return ["女","男"][value]||"未知"} },
		            { text: "地区    ", minWidth: 100, cellsRenderer:function(row, column, value, rowData){return rowData.country + "." + rowData.province + "." + rowData.city} },
		            { text: "消费次数", dataField: "totalCount", width: 100 },
		            { text: "消费额(￥)", dataField: "total", width: 100 },
		            { text: "购买商品总数", dataField: "totalNumber", width: 100 },
		            { text: "最常去的店", dataField: "count", minWidth: 100,cellsRenderer:function(row, column, value, rowData) {return value ? rowData.branch + "(" + value + "次)" : "无记录"} },
		            { text: "最喜爱的商品", dataField: "number", minWidth: 100,cellsRenderer:function(row, column, value, rowData) {return value ? rowData.menu + "(" + value + "份)" : "无记录"} }
		        ]
			});
		});